package game.objects 
{
	import flash.display.BitmapData;
	import flash.geom.Point;
	import net.flashpunk.Entity;
	import net.flashpunk.FP;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.utils.Input;
	import net.flashpunk.utils.Key;
	/**
	 * ...
	 * @author rnk
	 */
	public class Tester extends Entity
	{
		private var v:Point;
		
		public function Tester(x:Number,y:Number) 
		{
			this.x = x;
			this.y = y;
			
			v = new Point();
			
			graphic = new Image(new BitmapData(24, 24, false, 0x808080));
			setHitbox(24, 24, 0, 0);
			type = "player";
			
			
		}
		
		override public function update():void 
		{
			updateMovement();
			updateCollision();
			
			super.update();
		}
		
		private function updateMovement():void 
		{
			var m:Point = new Point();
			if (Input.check(Key.UP)) m.y--;
			if (Input.check(Key.DOWN)) m.y++;
			if (Input.check(Key.LEFT)) m.x--;
			if (Input.check(Key.RIGHT)) m.x++;
			
			if (Input.check(Key.Z)) 
			{
				FP.screen.scale -= 0.1;
			}
			if (Input.check(Key.X)) 
			{
				FP.screen.scale += 0.1;
			}
			
			v.x = m.x * 10;
			v.y = m.y * 10;
		}
		
		private function updateCollision():void 
		{
			x += v.x;
			y += v.y;
		}
		
	}

}